#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "Person.h"
#include "Student.h"
#include "Teacher.h"

using namespace std;

TEST(Person, case1)
{
    Person person("1", "Tom", 21);
    string actual = person.Introduce();

    EXPECT_THAT(actual, ::testing::Eq("My name is Tom. I am 21 years old."));
}

TEST(Student, parent_call)
{
    Klass klass(2);
    Student student("1", "Tom", 21, klass);

    Person person = student;
    string actual = person.Introduce();

    EXPECT_THAT(actual, ::testing::Eq("My name is Tom. I am 21 years old."));
}

TEST(Student, student_call)
{
    Klass klass(2);

    Student student("1", "Tom", 21, klass);

    Student person = student;
    string actual = person.Introduce();

    EXPECT_THAT(actual, ::testing::Eq("My name is Tom. I am 21 years old. I am a Student. I am at Class 2."));
}

string func(Person &person){
    return person.Introduce();
}

TEST(Student, reference_make_it_work)
{
    Klass klass(2);
    Student student("1", "Tom", 21, klass);

    Person &person = student;
    string actual = person.Introduce();


    EXPECT_THAT(actual, ::testing::Eq("My name is Tom. I am 21 years old. I am a Student. I am at Class 2."));
}



TEST(Student, pointer_make_it_work)
{
    Klass klass(2);
    Student student("1", "Tom", 21, klass);

    Person *person = &student;
    string actual = person->Introduce();

    EXPECT_THAT(actual, ::testing::Eq("My name is Tom. I am 21 years old. I am a Student. I am at Class 2."));
}

TEST(Teacher, introduce_with_klass_2)
{
    Klass klass(2);
    Teacher teacher("1", "Tom", 21, &klass);

    Person &person = teacher;
    string actual = person.Introduce();

    EXPECT_THAT(actual, ::testing::Eq("My name is Tom. I am 21 years old. I am a Teacher. I am teaching Class 2."));
}

TEST(Teacher, introduce_with_no_klass)
{
    Teacher teacher("1", "Tom", 21, nullptr);

    Person &person = teacher;
    string actual = person.Introduce();

    EXPECT_THAT(actual, ::testing::Eq("My name is Tom. I am 21 years old. I am a Teacher. I am teaching No Class."));
}
